from info.moudels.index import index_blu
from info import redis_store
from flask import render_template,current_app,send_file
from flask import redirect

# 13.从初始化文件加载蓝图
@index_blu.route('/')
def index():
    # 验证session
    # session['name'] = "hahah"
    # logging.debug("debug")redis_store.set("name", "laowang")
    # logging.error("error")
    # logging.warning("warning")
    # logging.info("info")
    # logging.fatal("fatal")
    #
    # current_app.logger.debug("我是flask的debug")
    # redis_store.set("name", "laowang")
    return render_template("news/index.html")
    # return "hahah"


@index_blu.route('/favicon.ico')
def favicon():
    # 这几种都可以
    # redirect("/static/news/favicon.ico")
    #return send_file("news/favicon.ico")
    return current_app.send_static_file("news/favicon.ico")